#include <TTree.h>
#include <TFile.h>
#include <TChain.h>
#include <iostream>
#include <fstream>

using namespace std;

void merger(int nline){

 char fname[100];

        ifstream file;
        file.open("file.list");


        TChain *ch = new TChain("t1");
        TTree::SetMaxTreeSize(50000000000);

        for (int ii=1; ii<nline+1; ii++){
                file >> fname;
//             sprintf(fname, "%d.root", ii);
                cout << fname << endl;
//                TFile f(fname);
                ch->Add(fname);                 
        }

        ch->Merge("merged.root");

}


